package com.citytransport.prokopjuk.servlets;

import java.io.IOException;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;

public class LogoutServlet extends AbstractCommand{

    private static final long serialVersionUID = -6317456893642814601L;
    static Logger logger = Logger.getLogger(LogoutServlet.class.getName());
    @Override
    public void processRequest(HttpServletRequest req, HttpServletResponse resp) {
	req.getSession(true).removeAttribute(LoginServlet.USER_ADM);
	logger.info("admin logged out");
	try {
	    resp.sendRedirect("/index.jsp");
	} catch (IOException e) {
	logger.error(e);
	}
    }
}
